package com.rocky.pubimport.common;

import lombok.Data;

/**
 * 统一响应对象
 */
@Data
public class ResultData {

    private Integer status;

    private String msg;

    private Object data;

    public ResultData() {

    }

    private ResultData(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public static ResultData ok() {
        return new ResultData(200, "ok", null);
    }

    public static ResultData ok(Object data) {
        return new ResultData(200, "ok", data);
    }

    public static ResultData error() {
        return new ResultData(-200, "操作失败", null);
    }

    public static ResultData error(String msg) {
        return new ResultData(-200, msg, null);
    }
}
